package com.bjsxt.shop.back.controller;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.bjsxt.shop.common.util.ConstantFinalUtil;
import com.bjsxt.shop.common.util.DateFormatUtil;
import com.bjsxt.shop.serviceApi.pojo.AAdmins;
import com.bjsxt.shop.serviceApi.service.IUserService;


@Controller
@RequestMapping("/back/admin/")
public class AdminController
{
	@Resource
	private IUserService userService;
	private DateFormatUtil dateFormatUtil = new DateFormatUtil();
	
	@RequestMapping("/adminsList")
	public String adminsList(String keyWord,String status,String stTime,String edTime,HttpServletRequest request)
	{
		Map<String,Object> condMap = new HashMap<String, Object>();
		condMap.put("keyWord", keyWord);
		try
		{
			condMap.put("status", Byte.valueOf(status));
			Date stDate = null;
			Date edDate = null;
			stDate = this.dateFormatUtil.toTimeDate(stTime);
			edDate = this.dateFormatUtil.toTimeDate(edTime);
		} catch (Exception e)
		{
		}
		List<AAdmins> adminsList = this.userService.findCondAAdminsList(condMap, null);
		request.setAttribute("adminsList", adminsList);
		return "/back/adminsList";
	}
	
	@RequestMapping("/main")
	public String main()
	{
		ConstantFinalUtil.LOGGER.info("-----main-----");
		return "/back/main";
	}
}
